import { defineConfig } from "vite";
import { createVuePlugin } from 'vite-plugin-vue2'
import { viteMockServe } from 'vite-plugin-mock'
import { resolve } from 'path'

export default defineConfig({
  plugins:[
    createVuePlugin({ jsx: true }),
    viteMockServe({
      mockPath: 'mock',
      localEnabled: true
    })
  ],
  build: {
    lib: {
      entry: resolve(__dirname, '.', 'src/CrudTableV2/index.js'),
      formats: ['umd', 'es'],
      name: 'ElCrudTableV2',
      fileName: 'index'
    },
    rollupOptions: {
      external: ['vue', 'element-ui'],
      output: {
        globals: {
          vue: 'Vue',
          'element-ui': 'ElemnetUI'
        }
      }
    }
  }
})